// 数字
function Rendnum(num,dom){
	num=num.toString()
	$(dom).html('')
	for(var i=0;i<num.length;i++){
		$(dom).append(`
			<span class="numbg">${num.charAt(i)}</span>
		`)
	}
}
// 日期
function formDate(){
	setInterval(function(){
		var d=new Date();
		var year=d.getFullYear();
		var month=change(d.getMonth()+1);
		var day=change(d.getDate());
		var hour=change(d.getHours());
		var minute=change(d.getMinutes());
		var second=change(d.getSeconds());
		var time=year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;
		var weekarr = ["日", "一", "二", "三", "四", "五", "六"]; 
		var key=d.getDay()
		document.getElementById('yue').innerHTML=year+'-'+month+'-'+day
		document.getElementById('shijian').innerHTML=hour+':'+minute
		document.getElementById('zhou').innerHTML='星期'+weekarr[key]
	},1000)			
}
// 当天日期
function showToDay() {     
	var Nowdate=new Date();     
	M=change(Number(Nowdate.getMonth())+1)         
	return Nowdate.getFullYear()+"-"+M+"-"+change(Nowdate.getDate());     
}
// 昨天日期
function showYesterDay(){     
	var tom=new Date();     
	tom.setDate(tom.getDate()-1);     
	M=change(Number(tom.getMonth())+1)     
	return tom.getFullYear()+"-"+M+"-"+change(tom.getDate());     
}
// 本周日期
function showWeekFirstDay(){     
	var Nowdate=new Date();     
	var WeekFirstDay=new Date(Nowdate-(Nowdate.getDay()-1)*86400000);     
	M=change(Number(WeekFirstDay.getMonth())+1)  
	return WeekFirstDay.getFullYear()+"-"+M+"-"+change(WeekFirstDay.getDate());     
}
// 上周日期
function showLastWeek(){     
	var Nowdate=new Date();     
	var WeekFirstDay=new Date(Nowdate-(Nowdate.getDay()-1)*86400000-7*86400000);     
	M=change(Number(WeekFirstDay.getMonth())+1)  
	return WeekFirstDay.getFullYear()+"-"+M+"-"+change(WeekFirstDay.getDate());     
}
// 上周日期最后一天
function showLastWeekDay(){     
	var Nowdate=new Date();     
	var WeekFirstDay=new Date(Nowdate-Nowdate.getDay()*86400000);     
	M=change(Number(WeekFirstDay.getMonth())+1)  
	return WeekFirstDay.getFullYear()+"-"+M+"-"+change(WeekFirstDay.getDate());     
}
// 本月日期
function showMonthFirstDay() {     
	var Nowdate=new Date();     
	var MonthFirstDay=new Date(Nowdate.getFullYear(),Nowdate.getMonth(),01);     
	M=change(Number(MonthFirstDay.getMonth())+1)     
	return MonthFirstDay.getFullYear()+"-"+M+"-"+change(MonthFirstDay.getDate());     
}
// 上月日期
function showLastMonthFirstDay() {     
	var Nowdate=new Date();     
	var MonthFirstDay=new Date(Nowdate.getFullYear(),Nowdate.getMonth()-1,01);     
	M=change(Number(MonthFirstDay.getMonth())+1)     
	return MonthFirstDay.getFullYear()+"-"+M+"-"+change(MonthFirstDay.getDate());     
}
// 上月最后一天
function showLastMonthDay(){     
	var Nowdate=new Date();     
	var MonthNextFirstDay=new Date(Nowdate.getFullYear(),Nowdate.getMonth(),01);     
	var MonthLastDay=new Date(MonthNextFirstDay-86400000);     
	M=change(Number(MonthLastDay.getMonth())+1)     
	return MonthLastDay.getFullYear()+"-"+M+"-"+change(MonthLastDay.getDate());     
}
// 本年日期
function showYearFirstDay() {     
	var Nowdate=new Date()   
	return Nowdate.getFullYear()+"-01-01";     
}
// 本年最后一天
function showYearDay(){     
	var Nowdate=new Date();   
	return Nowdate.getFullYear()+"-12-31";     
}
// 上年日期
function showLastYearFirstDay() {     
	var Nowdate=new Date()   
	return (Nowdate.getFullYear()-1)+"-01-01";     
}
// 上年最后一天
function showLastYearDay(){     
	var Nowdate=new Date();   
	return (Nowdate.getFullYear()-1)+"-12-31";     
}
function change(t){
	if(t<10){
	 return "0"+t;
	}else{
	 return t;
	}
}